package com.learning.thread.design.pc;

import java.util.concurrent.ConcurrentLinkedQueue;


/**
 * 
 * ClassName: Producer
 * Description: 生产者
 * date:
 * 
 * @author sm12652
 * @version V1.0
 * @since JDK 1.7
 */
public class Producer {

    /**
     * 共享缓冲区
     */
    private static final ConcurrentLinkedQueue<String> queue = new ConcurrentLinkedQueue<>();
    private static final Consumer consumer;

    static{
        consumer = new Consumer(queue);
        new Thread(consumer, "consumer-thread").start();
    }

    public static void shutDownThread() {
        consumer.shutDownThread();
    }

    static void addLogs(String str){
//        queue.add(str);//内部调用的offer
        queue.offer(str);
    }


}
